﻿using System.IO;

namespace ExcelAutomator.Validation
{
	public class FileValidator : BaseValidator
	{
		private readonly string m_FullFileName;

		public FileValidator(string fullFileName)
		{
			m_FullFileName = fullFileName;
		}

		public FileValidator FileExists()
		{
			if (Directory.Exists(m_FullFileName))
			{
				return this;
			}

			if (!File.Exists(m_FullFileName))
			{
				SetFailure(string.Format("The file '{0}' doesn't exists", m_FullFileName), "FileExists");
			}
			return this;
		}
	}
}
